home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / rexx / rxgen / part01
Encoding:
Internet Message Format  |  1991-02-12  |  44.9 KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i010: rxgen - call any library function from arexx, Part01/01
  4. Reply-To: rouaix@margaux.inria.fr
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v91i010@ab20.larc.nasa.gov>
  7. Date: 12 Feb 91 00:28:32 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga.misc
  11.  
  12. Submitted-by: rouaix@margaux.inria.fr
  13. Posting-number: Volume 91, Issue 010
  14. Archive-name: rexx/rxgen/part01
  15.  
  16. RXGEN is an ARexx library designed for the hacker.
  17. This library allows you to call any function of (almost) any amiga
  18. library from a Arexx program.
  19. I would say it is essentially useful under 2.0 to test some of
  20. the new "high-level" features of the system. It also works under 1.3.
  21. You can use the library to write small programs, when you don't want
  22. to use your C-compiler ! Eventually, your program will get bigger and
  23. bigger, and you'll find out that either you don't need your C-compiler,
  24. or that Arexx is slow (heheh).
  25. --Francois
  26.  
  27. #!/bin/sh
  28. # This is a shell archive.  Remove anything before this line, then unpack
  29. # it by saving it into a file and typing "sh file".  To overwrite existing
  30. # files, type "sh file -c".  You can also feed this as standard input via
  31. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  32. # will see the following message at the end:
  33. #        "End of archive 1 (of 1)."
  34. # Contents:  libs libs/rxgen.uu rexx rexx/FD2rxFD.rexx rexx/alert.rexx
  35. #   rexx/db.rexx rexx/fd.rexx rexx/port.rexx rexx/wbfront.rexx
  36. #   rexx/wbmaster.rexx rxgen.doc rxgen.readme
  37. # Wrapped by tadguy@ab20 on Mon Feb 11 19:28:29 1991
  38. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  39. if test ! -d 'libs' ; then
  40.     echo shar: Creating directory \"'libs'\"
  41.     mkdir 'libs'
  42. fi
  43. if test -f 'libs/rxgen.uu' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'libs/rxgen.uu'\"
  45. else
  46. echo shar: Extracting \"'libs/rxgen.uu'\" \(6963 characters\)
  47. sed "s/^X//" >'libs/rxgen.uu' <<'END_OF_FILE'
  48. Xbegin 700 rxgen.library
  49. XM```#\P`````````"``````````$```1,````*0```^D```1,<`!.=4K\````G
  50. XM!````6V``0D`````'@```"P```!.<GAG96XN;&EB<F%R>0!R>&=E;BYL:6)R6
  51. XM87)Y(#$N,"`H,3<@07!R(#$Y.#DI#0H`````+````%X```!V````H@```,X`9
  52. XM``#<````\@```3P```%`_____^````P)`,````H````>X```#@8`T```%``!^
  53. XMT```%@``P```&````"P`````+PTJ0"M.`"(CS@```5(K2``F0_D```%:<")._
  54. XMKOW8(\````%69P(@#2I?3G52;@`@"*X``P`J(`Y.=7``4VX`(&8,""X``P`JY
  55. XM9P1A```$3G5(YR`&*DXL;0`B2FT`(&<```P([0`#`"IP`&`H)"T`)B!-3J[_>
  56. XM!")Y```!5DZN_F)P`")-,"T`$)/`T&T`$DZN_RX@`DS?8`1.=7``3G59CR\/V
  57. XM+PA.N0```;Y03R!?3G4``````````')E>'AS>7-L:6(N;&EB<F%R>0````!.L
  58. XM5?_X2.<!`'#_*T#_^'X`#(<````$;"H@!W(,3KH/3B!`T?P````L+Q`O+0`(^
  59. XM3KH/7%!/2H!F!BM'__A@!%*'8,X@+?_X3-\`@$Y=3G5.5?[L2.<@`$*M_O`@2
  60. XM;0`(+R@`*&&<6$\K0/_X#(#_____9P``Q"!M``@B*``<`H$````/+T$`!'(,L
  61. XM3KH.XB!`T?P````L)"\`!+2H``AL!G`18```IB`M__A.N@["($#1_````"PB<
  62. XM:``$2&W^]"\M``A.D5!/*T#__$J`9G`@+?[T!(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$A`K2/_P4H@K2/_P#`$`(&<(<!(K0/_\8#)P`B!M9
  111. XM``P@@"!M``@@*``<`H`````/5X!(;?^D+RW_["\`3KH!+D_O``P@;0`,(4``6
  112. XM!$JM_^AG%B`M_]S0K?_87H`O`"\M_^A.N@604$]*K?_D9Q(@+?_<4H`O`"\M_
  113. XM_^1.N@5X4$]*K?_@9Q(@+?_84H`O`"\M_^!.N@5@4$\@+?_\3EU.=4SO`P,`Y
  114. XM!$CG/SY(>0``"WPL0-"!+P"?_````!!"@!`89P``$.6(*'P```O,*'0``$[46
  115. XM3-\3`4YU3-]\_$YU8-PO60`$8-8O60`(8-`D66#,)EE@R"]9``Q@PBI98+X@M
  116. XM&6"Z(!E@MB]9``!@L"(98*PD&6"H)AE@I"@98*`J&6"<+!E@F"X98)0```N"N
  117. XM```+J@``"[````NT```+N```"[P```O````+Q```"\@```N$```+B@``"Y``E
  118. XM``N4```+F```"YX```NB```+IDSO`P$`!$CG/SXN`%?(``@O,0``8/9.D-_''
  119. XM3-]\_$YU(&\`!$CG("(D2"QY````!$/Z`@9P`$ZN_=@D`&<<(D!.KOYB<`"T.
  120. XMJ@`89@XB*@`49P@@2BQ"3J[_6$J`3-]$!$YU3.\#```$80IF!B!O``P@B4YU0
  121. XM2.<0/B1()DEAIF<P+&H`&"!J`!1.KO^4*$@@2V$``+AF'"1))`$@3"`"<@!.G
  122. XMKO^X<`!0B4J!9P:3R6`"<`I*@$S??`A.=4SO`P``!$SO``,`#$CG/SY/[__T#
  123. XM)$@F22I`)@%!^@!8(D]A``$D($IA`/]`9TPL:@`8<`D,@P``__]N0"!J`!1.!
  124. XMKO^4*$@@2V$``$9F+B1))`$@3"`"3J[_OB@`($PB32`#80``EF<.($PB0"`$T
  125. XM3J[_K'``8`9P`V`"<`H@3R\`80``YB`?3^\`#$S??/Q.=4CG,#!T`'8`3J[^3
  126. XMX")(($QA6"1`9S9#Z@`(,"H`!"()#!D`+E?(__IF$,.)DHDF"B!,(`%A-"1`L
  127. XM9Q)!Z@`(3J[_FK)J``1G!G0H8`)T`TJ"9PP@3")*848@3")#84`B2B(#(`),R
  128. XMWPP,3G5(YX!`4(!2@$ZN_XY,WP(!9QXO"$*0,4``!!%\``(`!D(P"`A0B$ZNP
  129. XM_O(@7Q%```<@"$YU(@EG%'`!P"D`!F8,,"D`!%"`4H!.KO^(3G4O"R9J`!0CP
  130. XM2@``3.L``P#\2.L#``#\2.D``P`$)E].=2)H```B:0`43.@``P`$2.D``P#\&
  131. XM3G5R97AX<WES;&EB+FQI8G)A<GD``#(\_U)@<#(\_JI@:C(\_Q!@9'*48&`RK
  132. XM//\T8%HR//YH8%0R//]P8$XR//]\8$@R//]J8$(R//YZ8#PR//YT8#8R//YN8
  133. XM8#`R//YB8"HR//Z`8"0R//],8!YRB&`:,CS_%F`4<II@$#(\_R)@"C(\_QQ@8
  134. XM!#(\_UA,[P,```0@+P`,+PXL>0```59.MA``+%].=3(\_W9@X#(\_SI@VC(\S
  135. XM_HQ@U#(\_IY@SC(\_J1@R#(\_T9@PC(\_T!@O#(\_D1@MC(\_P1@L#(\_OY@=
  136. XMJC(\_OA@I#(\_O)@GC(\_NQ@F#(\_N!@DC(\_H9@C#(\_IA@AG*"8"`R//\H-
  137. XM8!HR//]D8!0R//Y08`YRCF`*,CS_+F`$,CS^YB!O``0@+P`(8`#_8C(\_LA@C
  138. XM$#(\_CY@"C(\_MI@!#(\_C@@+P`$8`#_1#)\_LY@$#)\_L)@"C)\_UY@!#)\'
  139. XM_I(@;P`$3.\``P`(+PXL>0```59.MI``+%].=4SO`P,`!,&(PXDO#BQY```!!
  140. XM5DZN_DHL7TYU3.\#`P`$P8C#B2\.+'D```%63J[^O"Q?3G5,[P,#``3!B,.)9
  141. XM+PXL>0```59.KOZV+%].=4SO`P,`!,&(PXDO#BQY```!5DZN_K`L7TYU(&\`1
  142. XM!#(\_M1A`/Z@(F\`""*!3G4@+P`$<J!A`/Z.(F\`""*(3G5(YP`Z)F\`%"!O[
  143. XM`!A#[P`<1?H`$BQY````!$ZN_?9,WUP`3G46P$YU+PXL>0```5),[P`#``A.[
  144. XMKO\Z+%].=0``+PXL>0```5(B;P`(("\`#$ZN_RXL7TYU+PXL>0```5(B;P`(C
  145. XM3J[^8BQ?3G4O#BQY```!4B)O``@@+P`,3J[]V"Q?3G4@0B)#)``F`4A"2$/$=
  146. XMP<;`P,'40TA"0D+0@B8))`A.=2!O``0B;P`($ABR&68(2@%F]G``3G5N!'#_G
  147. XM3G5P`4YU(&\`!$H89OQ3B)'O``0@"$YU``````/L````,0```````!#(```0@
  148. XMM```$)P``!"$```0)@``$`P```_R```/V```#[X```[@```,#```#`@```P$E
  149. XM```,````"_P```OX```+]```"_````OL```+Z```"^0```O@```+W```"]@`>
  150. XM``O4```+T```"\P```ML```+4````4@```$:````P@```+8```"L````F@``%
  151. XM`(````!N````:@```&8```!B````7@```%H```!6````4@```!H````6````P
  152. XM$@````H````&````#0````$```I6```*%@``"&````@.```%R@``!4P```06H
  153. XM```#V@```Y8```,V```"(````@````&4`````````_(```/J````*4=%3D]0L
  154. XM14Y,24(``$=%3D-,3U-%3$E"`$=%3D%#04Q,``!'14Y#0T%,3```````````!
  155. XM`L`````"````#```!-0````!````&```!T8````"````(@``"4H````"````'
  156. XM````````````)7,N;&EB<F%R>0``3$E"4RXE<P!,24)3+B5S+D]014Y#3U5.P
  157. XM5````$Q)0E,N)7,`3$E"4RXE<RXE<P`````#[`````0`````````5````$@`)
  158. XG```\````,`````0````!````4````$0````X````+`````````/R>
  159. X``
  160. Xend
  161. Xsize 4944
  162. END_OF_FILE
  163. if test 6963 -ne `wc -c <'libs/rxgen.uu'`; then
  164.     echo shar: \"'libs/rxgen.uu'\" unpacked with wrong size!
  165. fi
  166. # end of 'libs/rxgen.uu'
  167. fi
  168. if test ! -d 'rexx' ; then
  169.     echo shar: Creating directory \"'rexx'\"
  170.     mkdir 'rexx'
  171. fi
  172. if test -f 'rexx/FD2rxFD.rexx' -a "${1}" != "-c" ; then 
  173.   echo shar: Will not clobber existing file \"'rexx/FD2rxFD.rexx'\"
  174. else
  175. echo shar: Extracting \"'rexx/FD2rxFD.rexx'\" \(3828 characters\)
  176. sed "s/^X//" >'rexx/FD2rxFD.rexx' <<'END_OF_FILE'
  177. X/* This file is Copyright(C) 1990 Francois Rouaix and the Software Winery */
  178. X/* This file must be distributed unmodified in the RXGEN package          */
  179. X
  180. X
  181. X/* Transformation of _lib.fd files into .rxfd files */
  182. X/* SYNTAX: fdtorxfd <library name>                  */
  183. X/* Example: fdtorxfd exec                           */
  184. X/* You will have to configure the variables         */
  185. X/*    fddir   : directory of FD.FILES               */
  186. X/*    rxfddir : directory where to put .rxfd files  */
  187. X/* This program should take care of most of the     */
  188. X/* irregularities in the CBM FD.FILES               */
  189. X/* Register coding is                               */
  190. X/*  D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3 A4 A5 A6 A7 */
  191. X/*  01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E ** ** */
  192. X/*   A6 is reserved for library base                */
  193. X/*   A7 is SP (!)                                   */
  194. X
  195. Xparse arg libname
  196. X
  197. Xfddir   ="work:fd.files/"
  198. Xrxfddir ="work:rxgen/rxfd/"
  199. X
  200. Xsuccess = open('infd',lib2fd(libname),'Read')
  201. Xif ~success then do
  202. X    say "I can't file FD file for" libname "in" fddir
  203. X    exit 1
  204. X    end
  205. Xsuccess = open('outrxfd',lib2rxfd(libname),'Write')
  206. Xif ~success then do
  207. X    say "I can't open RXFD file for" libname "in" rxfddir
  208. X    exit 1
  209. X    end
  210. Xoffset = 0
  211. Xcall writeln('outrxfd',"LIBRARIES."||libname||" = '00 00 00 00'x")
  212. Xcall writeln('outrxfd',"LIBRARIES."||libname||".OPENCOUNT = 0")
  213. Xdo until eof('infd')
  214. X    line = readln('infd')
  215. X    select
  216. X        when left(line,1) == '*' then nop  /* skip comment */
  217. X        when left(line,6) == '##bias' then do
  218. X            parse var line '##bias' offset
  219. X            offset = strip(offset) /* should be ok for multiple bias */
  220. X            end
  221. X        when left(line,8) == '##public'  then nop
  222. X        when left(line,9) == '##private' then nop
  223. X        when left(line,6) == '##base' then nop
  224. X        when left(line,5) == '##end' then leave
  225. X        when length(line) == 0 then nop
  226. X        otherwise do
  227. X            firstopenpar=index(line,"(",1)
  228. X            fname=substr(line,1,firstopenpar - 1)
  229. X            call Writech('outrxfd',"LIBS."||libname||"."||fname||"=")
  230. X            call Writech('outrxfd',"'"||d2x(65536 - offset)||"'x||")
  231. X            offset = offset + 6
  232. X            numpars = 0
  233. X            regcoding = "'20"
  234. X            secondopenpar=index(line,"(",firstopenpar + 1)
  235. X            select /* are there any parameters ? */
  236. X                when secondopenpar = 0 then nop
  237. X                when substr(line,secondopenpar) = "()" then nop
  238. X                otherwise do
  239. X                    line = substr(line,secondopenpar)
  240. X                    do until left(line,1) = ")"
  241. X                        parse var line with 1 sep 2 regtype 3 regnum 4 line
  242. X                        numpars = numpars + 1
  243. X                        select
  244. X                            when upper(regtype) = 'A' then regnum = regnum + 9
  245. X                            when upper(regtype) = 'D' then regnum = regnum + 1
  246. X                            otherwise do
  247. X                                say "Bad reg definition"
  248. X                                exit 5
  249. X                                end
  250. X                            end /* of select */
  251. X                        regcoding = regcoding||"0"||d2x(regnum)
  252. X                        end  /* of do line */
  253. X                    end /* of otherwise*/
  254. X                end /* of select */
  255. X            if numpars ~= 0 then call writech('outrxfd',copies('?',numpars)||"||")
  256. X            call writech('outrxfd',regcoding||"'x")
  257. X            call writech('outrxfd','0A'x)
  258. X            say fname
  259. X            end /* of otherwise */
  260. X        end /* of select */
  261. X    end /* of do eof*/
  262. Xcall close('infd')
  263. Xcall close('outrxfd')
  264. Xexit 0
  265. X
  266. Xlib2fd: procedure expose fddir
  267. X    arg libname
  268. X    return fddir||libname||"_LIB.FD"
  269. X
  270. Xlib2rxfd: procedure expose rxfddir
  271. X    arg libname
  272. X    return rxfddir||libname||".rxfd"
  273. END_OF_FILE
  274. if test 3828 -ne `wc -c <'rexx/FD2rxFD.rexx'`; then
  275.     echo shar: \"'rexx/FD2rxFD.rexx'\" unpacked with wrong size!
  276. fi
  277. chmod +x 'rexx/FD2rxFD.rexx'
  278. # end of 'rexx/FD2rxFD.rexx'
  279. fi
  280. if test -f 'rexx/alert.rexx' -a "${1}" != "-c" ; then 
  281.   echo shar: Will not clobber existing file \"'rexx/alert.rexx'\"
  282. else
  283. echo shar: Extracting \"'rexx/alert.rexx'\" \(554 characters\)
  284. sed "s/^X//" >'rexx/alert.rexx' <<'END_OF_FILE'
  285. X/* AREXX program */
  286. XLIBS.intuition = '00 00 00 00'x
  287. XLIBS.intuition.OPENCOUNT = 0
  288. XLIBS.intuition.DisplayAlert='FFA6'x||ISI||'20010902'x
  289. Xif ~show('L','rxgen.library') then call addlib('rxgen.library',0,-30,0)
  290. X
  291. X/* have fun with user defined alert   */
  292. X/* this should appear GREEN under 2.0 */
  293. X
  294. XAlert=0
  295. XAlertString1='0065 0A'x||"Yoho here is the Guru !"||'00'x
  296. XAlertString2='0065 14'x||"Don't you laugh at me !"||'00'x
  297. Xcall GenOpenLib("intuition",0)
  298. Xcall GenACall("intuition","DisplayAlert",Alert,AlertString1 AlertString2,40)
  299. Xcall GenCloseLib("intuition")
  300. X
  301. END_OF_FILE
  302. if test 554 -ne `wc -c <'rexx/alert.rexx'`; then
  303.     echo shar: \"'rexx/alert.rexx'\" unpacked with wrong size!
  304. fi
  305. chmod +x 'rexx/alert.rexx'
  306. # end of 'rexx/alert.rexx'
  307. fi
  308. if test -f 'rexx/db.rexx' -a "${1}" != "-c" ; then 
  309.   echo shar: Will not clobber existing file \"'rexx/db.rexx'\"
  310. else
  311. echo shar: Extracting \"'rexx/db.rexx'\" \(325 characters\)
  312. sed "s/^X//" >'rexx/db.rexx' <<'END_OF_FILE'
  313. X/* AREXX program */
  314. XLIBS.intuition = '00 00 00 00'x
  315. XLIBS.intuition.OPENCOUNT = 0
  316. XLIBS.intuition.DisplayBeep='FFA0'x||I||'2009'x
  317. X
  318. Xif ~show('L','rxgen.library') then call addlib('rxgen.library',0,-30,0)
  319. X
  320. X/* no fuss here */
  321. Xcall GenOpenLib("intuition",0)
  322. Xcall GenACall("intuition","DisplayBeep",0)
  323. Xcall GenCloseLib("intuition")
  324. END_OF_FILE
  325. if test 325 -ne `wc -c <'rexx/db.rexx'`; then
  326.     echo shar: \"'rexx/db.rexx'\" unpacked with wrong size!
  327. fi
  328. chmod +x 'rexx/db.rexx'
  329. # end of 'rexx/db.rexx'
  330. fi
  331. if test -f 'rexx/fd.rexx' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'rexx/fd.rexx'\"
  333. else
  334. echo shar: Extracting \"'rexx/fd.rexx'\" \(5018 characters\)
  335. sed "s/^X//" >'rexx/fd.rexx' <<'END_OF_FILE'
  336. X/* This file is Copyright(C) 1990 Francois Rouaix and the Software Winery */
  337. X/* This file must be distributed unmodified in the RXGEN package          */
  338. X
  339. X/* Fd.rexx
  340. X    Syntax : FD INFO <functionname> [<libraryname>]
  341. X    Example: FD INFO FindPort exec
  342. X    Result : prints the description of the function (offset, registers)
  343. X
  344. X    Syntax : FD OFFS <offset> [<libraryname>]
  345. X    Example: FD OFFS FF7A exec
  346. X    Result : prints the description of the function
  347. X
  348. X    Syntax : FD LIBS
  349. X    Result : prints the available libraries (described by an FD.FILE)
  350. X*/
  351. X
  352. Xparse arg comselect others
  353. X
  354. Xdo while (words(getclip('FDDIR')) == 0)
  355. X    say "Please enter the directory where the FD.FILES reside:"
  356. X    say "Exemple:      Extras 1.3:FD1.3"
  357. X    pull fddir
  358. X    fddir = strip(fddir)
  359. X    call setclip('FDDIR',fddir)
  360. Xend
  361. Xfddir=getclip('FDDIR')
  362. Xfdfiles=showdir(fddir,'File')
  363. Xcomselect = upper(comselect)
  364. Xselect
  365. X   when comselect=='INFO' then do
  366. X            parse var others functionname libname
  367. X            if length(libname) == 0
  368. X                then call map('findin  '''functionname"',", fdfiles)
  369. X            else call findin(functionname,strip(libname)||'_LIB.FD')
  370. X            end
  371. X    when comselect=='OFFS' then do
  372. X        parse var others offs libname
  373. X        select
  374. X            when datatype(offs) == NUM then nop
  375. X            when datatype(offs) == CHAR then offs=x2d(offs) - 65536
  376. X            otherwise do
  377. X                    say "Offset: -num (-30)"
  378. X                    say "         hex (FFA0)"
  379. X                    exit 0
  380. X                end
  381. X            end
  382. X        if length(libname) == 0
  383. X            then call map('getfunc ' offs ",", fdfiles)
  384. X            else call getfunc(offs,strip(libname)||'_LIB.FD')
  385. X        end
  386. X    when comselect=='LIBS' then do
  387. X        fdlibs = map('fname2libname', fdfiles)
  388. X        say "Libraries:" fdlibs
  389. X        end
  390. X    otherwise
  391. X        do
  392. X            say "Syntax  :  FD INFO <functionname> [<libraryname>]"
  393. X            say "           FD OFFS <offset> [<libraryname>]"
  394. X            say "           FD LIBS"
  395. X        end
  396. X    end
  397. X
  398. Xexit 0
  399. X
  400. X/* this should be familiar to you ol' lispers */
  401. Xmap: procedure expose fddir
  402. X    if (words(arg(2)) == 0)
  403. X        then return('')
  404. X        else
  405. X            parse value arg(2) with _car _cdr
  406. X            interpret 'call' arg(1) '_car'
  407. X            leftval = result
  408. X           return( leftval  map(arg(1), _cdr))
  409. X
  410. Xfname2libname: procedure
  411. X    arg _fname
  412. X    parse upper var _fname _libname '_LIB.FD'
  413. X    return _libname
  414. X
  415. Xfindin: procedure expose fddir
  416. X    success = open('handle',fddir||'/'||arg(2),'Read')
  417. X    found = 0
  418. X    offset = 0
  419. X    privateflag = 'public '
  420. X    if success then do until (found | eof('handle'))
  421. X        line = readln('handle')
  422. X        select
  423. X            when left(line,1) == '*' then nop
  424. X            when left(line,6) == '##bias' then  do
  425. X                parse var line '##bias' offset
  426. X                offset = strip(offset)
  427. X                end
  428. X            when left(line,8) == '##public'  then privateflag = 'public '
  429. X            when left(line,9) == '##private' then privateflag = 'private'
  430. X            when left(line,5) == '##end' then do close('handle') ; return('') ; end
  431. X            when left(line,6) == '##base' then nop
  432. X            otherwise do
  433. X                if upper(left(line,length(arg(1)))) == upper(arg(1))
  434. X                    then found = 1
  435. X                    else offset = offset + 6
  436. X
  437. X                end
  438. X            end
  439. X        end
  440. X    else do
  441. X        say "I don't find" arg(2) "in" fddir
  442. X        return('')
  443. X        end
  444. X    call close('handle')
  445. X    if found
  446. X        then do
  447. X            res=left(fname2libname(arg(2)),20) privateflag left('-'offset,4) d2x(65536 - offset) line
  448. X            say res
  449. X            return('')
  450. X            end
  451. X        else return('')
  452. X
  453. Xgetfunc: procedure expose fddir /* offs library */
  454. X    success = open('handle',fddir||'/'||arg(2),'Read')
  455. X    found = 0
  456. X    offset = 0
  457. X    privateflag = 'public '
  458. X    if success then do until (found | eof('handle'))
  459. X        line = readln('handle')
  460. X        select
  461. X            when left(line,1) == '*' then nop
  462. X            when left(line,6) == '##bias' then  do
  463. X                parse var line '##bias' offset
  464. X                offset = strip(offset)
  465. X                end
  466. X            when left(line,8) == '##public'  then privateflag = 'public '
  467. X            when left(line,9) == '##private' then privateflag = 'private'
  468. X            when left(line,5) == '##end' then do close('handle') ; return('') ; end
  469. X            when left(line,6) == '##base' then nop
  470. X            otherwise do
  471. X                if (offset == -arg(1))
  472. X                    then found = 1
  473. X                    else offset = offset + 6
  474. X                end
  475. X            end
  476. X        end
  477. X    else do
  478. X        say "I don't find" arg(2) "in" fddir
  479. X        return('')
  480. X        end
  481. X    call close('handle')
  482. X    if found
  483. X        then do
  484. X            res=left(fname2libname(arg(2)),20) privateflag left('-'offset,4) d2x(65536 - offset) line
  485. X            say res
  486. X            return('')
  487. X            end
  488. X        else return('')
  489. END_OF_FILE
  490. if test 5018 -ne `wc -c <'rexx/fd.rexx'`; then
  491.     echo shar: \"'rexx/fd.rexx'\" unpacked with wrong size!
  492. fi
  493. chmod +x 'rexx/fd.rexx'
  494. # end of 'rexx/fd.rexx'
  495. fi
  496. if test -f 'rexx/port.rexx' -a "${1}" != "-c" ; then 
  497.   echo shar: Will not clobber existing file \"'rexx/port.rexx'\"
  498. else
  499. echo shar: Extracting \"'rexx/port.rexx'\" \(1615 characters\)
  500. sed "s/^X//" >'rexx/port.rexx' <<'END_OF_FILE'
  501. X/* AREXX Program */
  502. X/* I let you find out how to get out of this program
  503. X   easily.
  504. X   Answer at the end of the file (may not be really clean...)
  505. X*/
  506. XLIBRARIES.exec = '00 00 00 00'x
  507. XLIBRARIES.exec.OPENCOUNT = 0
  508. XLIBS.exec.FindPort='FE7A'x||S||'200A'x
  509. XLIBS.exec.AddPort='FE9E'x||A||'200A'x
  510. XLIBS.exec.RemPort='FE98'x||A||'200A'x
  511. XLIBS.exec.PutMsg='FE92'x||AA||'20090A'x
  512. XLIBS.exec.GetMsg='FE8C'x||A||'2009'x
  513. XLIBS.exec.ReplyMsg='FE86'x||A||'200A'x
  514. XLIBS.exec.WaitPort='FE80'x||A||'2009'x
  515. XLIBS.exec.AllocMem='FF3A'x||IA||'200102'x
  516. XLIBS.exec.FreeMem='FF2E'x||AI||'200A01'x
  517. XLIBS.exec.Wait='FEC2'x||A||'2001'x
  518. X
  519. X/* Note that we are going to mix AREXX support functions
  520. X   and rxgen functions
  521. X*/
  522. XPORTNAME = 'TESTPORT'
  523. Xcall GenOpenLib("exec",0)
  524. Xmyport = GenACall("exec","FindPort",PORTNAME)
  525. Xif myport = NULL() then do
  526. X    theport = OPENPORT(PORTNAME)
  527. X    myport = GenACall("exec","FindPort",PORTNAME)
  528. X    sigbitraw = import(OFFSET(myport,15),1)
  529. X    sigbit = c2d(sigbitraw)
  530. X    say "Signal Bit:" sigbit
  531. X    if myport = NULL() then do
  532. X                                say "Can't create port"
  533. X                                exit 1
  534. X                            end
  535. X    else do 10
  536. X            msg = GenACall("exec","Wait",bitset(NULL(),sigbit))
  537. X            say "Wait returned"
  538. X            do msgloop=0
  539. X                msg = GenACall("exec","GetMsg",myport)
  540. X                if msg = null() then leave msgloop
  541. X                call GenACall("exec","ReplyMsg",msg)
  542. X            end
  543. X         end
  544. X    end
  545. Xcall GenCloseLib("exec")
  546. Xcall CLOSEPORT(PORTNAME)
  547. X
  548. X/* did you find out ? */
  549. X/* here you are:
  550. X   rx "do forever; address TESTPORT; end"
  551. X*/
  552. END_OF_FILE
  553. if test 1615 -ne `wc -c <'rexx/port.rexx'`; then
  554.     echo shar: \"'rexx/port.rexx'\" unpacked with wrong size!
  555. fi
  556. chmod +x 'rexx/port.rexx'
  557. # end of 'rexx/port.rexx'
  558. fi
  559. if test -f 'rexx/wbfront.rexx' -a "${1}" != "-c" ; then 
  560.   echo shar: Will not clobber existing file \"'rexx/wbfront.rexx'\"
  561. else
  562. echo shar: Extracting \"'rexx/wbfront.rexx'\" \(322 characters\)
  563. sed "s/^X//" >'rexx/wbfront.rexx' <<'END_OF_FILE'
  564. X/* AREXX program */
  565. XLIBS.intuition = '00 00 00 00'x
  566. XLIBS.intuition.OPENCOUNT = 0
  567. XLIBS.intuition.WBenchToBack='FEB0'x||'20'x
  568. XLIBS.intuition.WBenchToFront='FEAA'x||'20'x
  569. X
  570. X/* can you write a shorter program for that ? */
  571. Xcall GenOpenLib("intuition",0)
  572. Xcall GenACall("intuition","WBenchToFront")
  573. Xcall GenCloseLib("intuition")
  574. END_OF_FILE
  575. if test 322 -ne `wc -c <'rexx/wbfront.rexx'`; then
  576.     echo shar: \"'rexx/wbfront.rexx'\" unpacked with wrong size!
  577. fi
  578. chmod +x 'rexx/wbfront.rexx'
  579. # end of 'rexx/wbfront.rexx'
  580. fi
  581. if test -f 'rexx/wbmaster.rexx' -a "${1}" != "-c" ; then 
  582.   echo shar: Will not clobber existing file \"'rexx/wbmaster.rexx'\"
  583. else
  584. echo shar: Extracting \"'rexx/wbmaster.rexx'\" \(9869 characters\)
  585. sed "s/^X//" >'rexx/wbmaster.rexx' <<'END_OF_FILE'
  586. X/* This file is Copyright(C) 1990 Francois Rouaix and the Software Winery */
  587. X/* This file must be distributed unmodified in the RXGEN package          */
  588. X
  589. X/* An attempt at using the new features of the 2.0 Workbench library
  590. X   Warning, look for comments /* WSHELL */ and /* CLI */ to fix the program
  591. X   By default, the script in the distribution is configured for CLI, as
  592. X   WShell is not yet distributed with 2.0 ;-)
  593. X
  594. X    WSH> WBMASTER -INIT
  595. X    WSH> WBMASTER <MENUNAME> <RXCLAUSE>
  596. X     ....
  597. X    Quit with menu
  598. X
  599. X    CLI> rx WBMASTER -INIT
  600. X    CLI> rx WBMASTER <MENUNAME> <RXCLAUSE>
  601. X     ....
  602. X    Quit with menu
  603. X
  604. X    The -INIT call will init a "server process", which is called -RUN.
  605. X    -RUN will add a QUIT item in the Workbench Tools menu.
  606. X    The other kind of call will add an item of name <MENUNAME>. When you
  607. X    activate this item, the <RXCLAUSE> will be INTERPRETed by the
  608. X    server process.
  609. X
  610. XExample:
  611. X    rx wbmaster -INIT
  612. X    rx wbmaster Editor address command 'new:c/az'
  613. X    rx wbmaster Shell  address command 'newshell'
  614. X
  615. XWARNING: despite some efforts, there are still problems
  616. X    1) if the rxclause (executed when activating a menu) raises
  617. X        an error, then you're lost. Try WBMASTER -QUIT to free
  618. X        the ressources. However, don't try -QUIT option if -RUN is alive
  619. X    2) you can't remove a menu item individually
  620. X       but you can patch the action of a menu item by hacking directly
  621. X       the clip value WBACTIONi (see source)
  622. X    3) you'll have to figure out what king of actions may be taken !
  623. X        Easy ones: ADDRESS COMMAND 'cli-detaching-command'
  624. X        Easy ones: ADDRESS COMMAND 'run cli-permanent-command'
  625. X            use the quotes to avoid syntax errors...
  626. X        Try to interpret your clause with rx "INTERPRET <clause>"
  627. X            to check before installing as a menu action
  628. X        Tricky ones: parameterised actions, using Arexx clipboard as globals
  629. X        Hacks: dynamic modification of the server Arexx program ....
  630. X    4) I've not really checked if all memory/ressources are freed
  631. X        if everything goes wrong
  632. X    Remember this is just a hack !
  633. X*/
  634. X
  635. Xarg COM PAR
  636. X
  637. X/* exec library */
  638. XLIBRARIES.exec = '00 00 00 00'x
  639. XLIBRARIES.exec.OPENCOUNT = 0
  640. XLIBS.exec.FindPort='FE7A'x||S||'200A'x
  641. XLIBS.exec.AddPort='FE9E'x||A||'200A'x
  642. XLIBS.exec.RemPort='FE98'x||A||'200A'x
  643. XLIBS.exec.PutMsg='FE92'x||AA||'20090A'x
  644. XLIBS.exec.GetMsg='FE8C'x||A||'2009'x
  645. XLIBS.exec.ReplyMsg='FE86'x||A||'200A'x
  646. XLIBS.exec.WaitPort='FE80'x||A||'2009'x
  647. XLIBS.exec.Wait='FEC2'x||A||'2001'x
  648. XLIBS.exec.CreateMsgPort='FD66'x||'20'x
  649. XLIBS.exec.DeleteMsgPort='FD60'x||A||'2009'x
  650. XLIBS.exec.AllocMem='FF3A'x||IA||'200102'x
  651. XLIBS.exec.FreeMem='FF2E'x||AI||'200A01'x
  652. X
  653. X/* workbench library */
  654. XLIBRARIES.workbench = '00 00 00 00'x
  655. XLIBRARIES.workbench.OPENCOUNT = 0
  656. XLIBS.workbench.AddAppMenuItem='FFB8'x||IAAA||'200102090A'x
  657. XLIBS.workbench.RemoveAppMenuItem='FFB2'x||A||'2009'x
  658. X
  659. XPORTNAME='WB-AREXX'
  660. XPORTLEN = 9
  661. X
  662. Xselect
  663. X    when upper(arg(1)) = '-INIT' then do
  664. X/* this is some kind CLI-detach hack for ARexx scripts */
  665. X/* note the the MsgPort MUST be created by the task who is going
  666. X    to receive the signals (that's because CreateMsgPort initializes
  667. X    the port structure according to the caller's task)
  668. X   Therefore we reload ourselves asynchronously (ickk) without doing anything
  669. X*/
  670. X        call GenOpenLib("exec",36)
  671. X        myport = GenACall("exec","FindPort",PORTNAME)
  672. X        if myport = NULL() then
  673. X                /* ADDRESS command 'run rx WBMASTER -RUN' /* this gives IO */ */
  674. X                ADDRESS AREXX 'WBMASTER -RUN'
  675. X        else say "WBMASTER already up and running"
  676. X        call GenCloseLib("exec")
  677. X        end /* end of -INIT */
  678. X
  679. X    when upper(arg(1)) = '-RUN' then do
  680. X        /* we shouldn't quit but by user control             */
  681. X        /* it does not seem to make a difference, but why ?  */
  682. X        signal off syntax
  683. X        signal off error
  684. X        call GenOpenLib("exec",36)
  685. X        myport = GenACall("exec","FindPort",PORTNAME)
  686. X        if myport = NULL() then do
  687. X            myport = GenACall("exec","CreateMsgPort")
  688. X            if myport = NULL() then do
  689. X                                        say "Can't create port"
  690. X                                        exit 1
  691. X                                    end
  692. X            else do
  693. X            /* we MUST initialize the name and priority (RTFM) */
  694. X                copystr = GenACall("exec","AllocMem",PORTLEN,'0001 0001'x)
  695. X                call export(copystr,PORTNAME,PORTLEN)
  696. X                call export(OFFSET(myport,10),copystr,4)
  697. X                call export(OFFSET(myport,9),NULL(),1)
  698. X                call GenACall("exec","AddPort",myport)
  699. X                say "Port " PORTNAME " created"
  700. X                sigbitraw = import(OFFSET(myport,15),1)
  701. X                sigbit = c2d(sigbitraw)
  702. X                say "Signal Bit:" sigbit
  703. X                call setclip('WBINDEX',-1)
  704. X                /* setting quit item: magic ! */
  705. X                /* we add an item with no action, but it MUST be the first */
  706. X                /* there is a special case for this in the server process  */
  707. X                /* 'WBMASTER ' QUIT   /* for use with WSHELL ONLY */ */
  708. X                address command 'rx WBMASTER QUIT'  /* for use with CLI */
  709. X                end
  710. X            end
  711. X        else do
  712. X            say "WBMASTER already up and running"
  713. X            exit 1
  714. X            end
  715. X        do quitloop=0
  716. X            msg = GenACall("exec","Wait",bitset(NULL(),sigbit))
  717. X            do msgloop=0
  718. X                msg = GenACall("exec","GetMsg",myport)
  719. X                if msg = null() then leave msgloop
  720. X                am_Type     =  c2x(IMPORT(OFFSET(msg,20),2))
  721. X                am_UserData =  c2x(IMPORT(OFFSET(msg,22),4))
  722. X                am_ID       =  c2d(IMPORT(OFFSET(msg,26),4))
  723. X                am_NumArgs  =  c2d(IMPORT(OFFSET(msg,30),4))
  724. X                call GenACall("exec","ReplyMsg",msg)
  725. X                /* I don't know exactly where the output will go...
  726. X                  at least if the trace console is open, output will go there
  727. X                  in beta versions of 2.0, there used to be gurus, now with
  728. X                  2.01, everything runs fine
  729. X                */
  730. X                say "Type:" am_Type  "UserData:" am_UserData "Id:" am_ID "NumArgs:" am_NumArgs
  731. X                if am_ID = 0 then leave quitloop
  732. X                action = getclip('WBACTION'||am_ID)
  733. X                say "Interpreting" action
  734. X                INTERPRET action  /* whoaaaaahhh */
  735. X            end  /* of msgloop */
  736. X        end /* of quit loop */
  737. X        /* normal deallocation follows */
  738. X        /* ADDRESS AREXX 'WBMASTER -QUIT' /* pb: ??? when -RUN was launched by addressing AREXX*/ */
  739. X        ADDRESS COMMAND 'rx WBMASTER -QUIT'
  740. X    end /* end of -RUN */
  741. X
  742. X    /* this is the cleanup: this portion of the code should be executed
  743. X       by the -RUN process when you quit, but in case something goes wrong,
  744. X       we need a cleanup (DON'T RUN THIS IF -RUN IS ALIVE)
  745. X    */
  746. X    when upper(arg(1)) = '-QUIT' then do
  747. X        call GenOpenLib("exec",36)
  748. X        myport = GenACall("exec","FindPort",PORTNAME)
  749. X        if myport = NULL() then do
  750. X                            say "WBMASTER is not running"
  751. X                            end
  752. X        else do /* first delete the port*/
  753. X            call GenACall("exec","RemPort",myport)
  754. X            do msgloop=0
  755. X                msg = GenACall("exec","GetMsg",myport)
  756. X                if msg = NULL() then leave msgloop
  757. X                call GenACall("exec","ReplyMsg",msg)
  758. X                end
  759. X            call GenACall("exec","FreeMem",IMPORT(OFFSET(myport,10),4),PORTLEN)
  760. X            call GenACall("exec","DeleteMsgPort",myport)
  761. X            end
  762. X        /* cleanup the menu */
  763. X        call GenOpenLib("workbench",36)
  764. X        do i=0 to getclip('WBINDEX')
  765. X            item = getclip('WBITEM'i)
  766. X            call GenACall("workbench","RemoveAppMenuItem",item)
  767. X            text = getclip('WBTEXT'i)
  768. X            textlen = getclip('WBTEXTLEN'i)
  769. X            call GenACall("exec","FreeMem",text,textlen)
  770. X            end
  771. X        call setclip('WBINDEX',-1) /* Avoid multiple FreeMems if run twice*/
  772. X        call GenCloseLib("workbench")
  773. X        call GenCloseLib("exec")
  774. X        end
  775. X
  776. X    /* general case: install the menu item */
  777. X    otherwise do
  778. X        call GenOpenLib("exec",36)
  779. X        myport = GenACall("exec","FindPort",PORTNAME)
  780. X        if myport = NULL() then do
  781. X                                    say "Can't find " PORTNAME
  782. X                                    call GenCloseLib("exec")
  783. X                                    exit 1
  784. X                                end
  785. X        call GenOpenLib("workbench",36)
  786. X        index = getclip('WBINDEX')
  787. X        index = index+1
  788. X        call setclip('WBINDEX',index)
  789. X        COM = strip(com)
  790. X        par = strip(par)
  791. X        /* allocate copy of the string */
  792. X        copystr = GenACall("exec","AllocMem",length(COM)+1,'0001 0001'x)
  793. X        call export(copystr,COM,length(COM)+1)
  794. X
  795. X        item = GenACall("workbench","AddAppMenuItem",index,NULL(),copystr,myport)
  796. X        if item = NULL() then do
  797. X                                say "Adding item failed"
  798. X                                exit 1
  799. X                               end
  800. X        call setclip('WBITEM'index,item)
  801. X        call setclip('WBTEXT'index,copystr)
  802. X        call setclip('WBTEXTLEN'index,length(COM)+1)
  803. X        call setclip('WBACTION'index,PAR)
  804. X        call GenCloseLib("workbench")
  805. X        call GenCloseLib("exec")
  806. X        end /* of otherwise */
  807. Xend /* of select */
  808. Xexit 0
  809. X
  810. X/* Hm, we need some offsets.
  811. Xstruct AppMessage {
  812. X    struct Message am_Message;  /* standard message structure */
  813. X    UWORD am_Type;              /* message type */
  814. X    ULONG am_UserData;          /* application specific */
  815. X    ULONG am_ID;                /* application definable ID */
  816. X    LONG am_NumArgs;            /* # of elements in arglist */
  817. X    struct WBArg *am_ArgList;   /* the arguements themselves */
  818. X};
  819. X*/
  820. END_OF_FILE
  821. if test 9869 -ne `wc -c <'rexx/wbmaster.rexx'`; then
  822.     echo shar: \"'rexx/wbmaster.rexx'\" unpacked with wrong size!
  823. fi
  824. chmod +x 'rexx/wbmaster.rexx'
  825. # end of 'rexx/wbmaster.rexx'
  826. fi
  827. if test -f 'rxgen.doc' -a "${1}" != "-c" ; then 
  828.   echo shar: Will not clobber existing file \"'rxgen.doc'\"
  829. else
  830. echo shar: Extracting \"'rxgen.doc'\" \(5894 characters\)
  831. sed "s/^X//" >'rxgen.doc' <<'END_OF_FILE'
  832. XTABLE OF CONTENTS
  833. X
  834. Xrxgen.library/GenOpenLib
  835. Xrxgen.library/GenCloseLib
  836. Xrxgen.library/GenACall
  837. Xrxgen.library/Function Description Format
  838. X
  839. X
  840. Xrxgen.library/GenOpenLib                             rxgen.library/GenOpenLib
  841. X
  842. XNAME
  843. X    GenOpenLib  -opens an exec library from Arexx
  844. X
  845. XSYNOPSIS
  846. X    call GenOpenLib("library name",version)
  847. X
  848. XFUNCTION
  849. X    REQUIREMENTS: the ARexx variables
  850. X                LIBS.libname
  851. X                LIBS.libname.OPENCOUNT
  852. X            should be properly initialized when you open the library for
  853. X            the first time.
  854. X            For example, if you want to open exec.library, use the
  855. X            following clauses:
  856. X                LIBS.EXEC = '0000 0000'x
  857. X                LIBS.EXEC.OPENCOUNT = 0
  858. X    Opens the specified library, using the specified version number.
  859. X    If the library can be opened, its base will be stored in LIBS.libname,
  860. X    and the open count (for GenOpenLib calls in the current program only)
  861. X    will be incremented in LIBS.libname.OPENCOUNT
  862. X    Failure to open the library will raise an ERROR
  863. X
  864. XINPUTS
  865. X    "library name" is the name of the library you want to open
  866. X        (without .library suffix)
  867. X    version is an integer
  868. XRESULT
  869. X    You're not interested in the result (it is the opencount at this time,
  870. X    but this is subject to change).
  871. X    See above for side effects
  872. X
  873. XEXAMPLE
  874. X    LIBS.intuition = '0000 0000'x
  875. X    LIBS.intuition.OPENCOUNT = 0
  876. X    call GenOpenLib("intuition",0)
  877. X
  878. XBUGS
  879. X    Use of version not really tested.
  880. X    Multiple uses with different version numbers are not supported.
  881. X
  882. X
  883. Xrxgen.library/GenCloseLib                           rxgen.library/GenCloseLib
  884. X
  885. X
  886. XNAME
  887. X    GenCloseLib     -close a library from Arexx
  888. X
  889. XSYNOPSIS
  890. X    call GenCloseLib("libname")
  891. X
  892. XFUNCTION
  893. X    REQUIREMENTS: same as GenOpenLib, it is also better if the
  894. X                  library has been opened...
  895. X    Closes a library that has been opened by GenOpenLib.
  896. X    Will fail if the opencount of the library is <= 0, otherwise,
  897. X    the library will be closed, and the opencount decremented. If the count
  898. X    gets null, then the base of the library will be set to 0.
  899. X
  900. XINPUTS
  901. X    "libname" : the name of the library you want to close (what else ?)
  902. X
  903. XRESULT
  904. X    You're not interested in the result (it is the opencount at this time,
  905. X    but this is subject to change).
  906. X    See above for side effects
  907. X
  908. XEXAMPLE
  909. X    call GenCloseLib("intuition")
  910. X
  911. XBUGS
  912. X    Maybe.
  913. X
  914. X
  915. Xrxgen.library/GenACall                                  rxgen.library/GenACall
  916. XNAME
  917. X    GenACall        - call a function from ARexx
  918. X
  919. XSYNOPSIS
  920. X    something = GenACall("libname","fname",par,...)
  921. X
  922. XFUNCTION
  923. X    REQUIREMENTS:
  924. X        the library should have been opened (see GenOpenLib)
  925. X        the function fname should be defined by
  926. X            LIBS.libname.fname = <description>
  927. X        the format of the description is described later.
  928. X    GenACall will check the base of the library, convert your parameters
  929. X    following the description, and return (hopefully) the result.
  930. X    If the library base is 0, the function will abort (ERROR).
  931. X    If GenACall can't find the function description, it will abort.
  932. X
  933. XINPUTS
  934. X    "libname" the name of the library your function belongs to
  935. X    "fname"   the name of the function
  936. X    par,...   parameters for the real function call. Many types allowed,
  937. X              check the format of the description
  938. X
  939. XRESULT
  940. X    A 32 bit word, hopefully a correct one...
  941. X
  942. XEXAMPLE
  943. X    pointer = GenACall("exec","FindPort",'FOO BAR')
  944. X
  945. XBUGS
  946. X    Surely. None found.
  947. X
  948. X
  949. Xrxgen.library/Function Description Format
  950. X
  951. X
  952. XDescription of the format:
  953. XLet's take an example to fix the ideas
  954. XLIBS.exec.FindPort='FE7A'x||S||'200A'x
  955. XThus, the format is a string containing:
  956. X    - two bytes for the offset of the function in the library
  957. X    - a variable number of characters that describe the type of
  958. X    conversion to be applied to the parameters
  959. X    - a SPACE (here obtained by '20'x)
  960. X    - a coding of the registers in which the parameters will be passed.
  961. X
  962. XYou don't have to find all this by yourself.
  963. XThe FD2rxFD utility provided in this distribution is able to compute a
  964. Xpartial description from the FD.FILES (to be found on Extras disk).
  965. XCheck the two directory variables in the program, and run
  966. X1> rx fd2rxfd exec
  967. XThis will generate a file containing all (partial) function definitions
  968. Xfor the Exec library.
  969. X
  970. XIn this examples, the information given by the FD.FILES is
  971. XLIBS.exec.FindPort='FE7A'x||?||'200A'x
  972. XThe question mark (?) is to be replaced by the proper type description.
  973. X
  974. X    Technical digression: the problem lies in the fact that datas in ARexx are
  975. X    not typed. They all are represented by strings, with no way to determine
  976. X    safely and systematically if a particular data is a "real" string, or
  977. X    an integer, or a pointer.
  978. X
  979. XYou will have to find by yourself (consulting the proper docs) which kind
  980. Xof conversion is needed.
  981. XIn this version (1.0), the supported conversion are:
  982. X    I   the ARexx data represents an integer
  983. X        It will be converted internally to a 32bit integer with the AREXX
  984. X        function CVa2i().
  985. X        Valid data examples:        Invalid data:
  986. X            1                           'foobar'
  987. X            324
  988. X
  989. X    S   the ARexx data represents a string.
  990. X        No conversion is applied. The pointer to the string is used as
  991. X        an argument
  992. X        Valid data: any
  993. X
  994. X    A   the ARexx data represents a pointer.
  995. X        It MUST be a 4-byte long string, containing the value of the
  996. X        pointer (usual convention for pointers in AREXX).
  997. X        The "raw" value of the data will be used.
  998. X        Valid data examples:
  999. X            '00 00 00 00'x
  1000. X            '00 00 06 76'x
  1001. X
  1002. XIn the example, the parameter is a port name, so the conversion should be S.
  1003. X
  1004. X
  1005. XRegister coding is
  1006. X  D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3 A4 A5 A6 A7
  1007. X  01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E ** **
  1008. X   A6 is reserved for library base
  1009. X   A7 is SP. Don't dare to use it.
  1010. X
  1011. END_OF_FILE
  1012. if test 5894 -ne `wc -c <'rxgen.doc'`; then
  1013.     echo shar: \"'rxgen.doc'\" unpacked with wrong size!
  1014. fi
  1015. chmod +x 'rxgen.doc'
  1016. # end of 'rxgen.doc'
  1017. fi
  1018. if test -f 'rxgen.readme' -a "${1}" != "-c" ; then 
  1019.   echo shar: Will not clobber existing file \"'rxgen.readme'\"
  1020. else
  1021. echo shar: Extracting \"'rxgen.readme'\" \(4005 characters\)
  1022. sed "s/^X//" >'rxgen.readme' <<'END_OF_FILE'
  1023. X/*
  1024. X *===========================================================================
  1025. X * \__________/ Copyright (c) 1990 Francois Rouaix and The Software Winery.
  1026. X *  \o   o   /  All Rights Reserved. This program may not be distributed
  1027. X *   \ o   o/   without the permission of the author:
  1028. X *    \  o /         Francois Rouaix
  1029. X *     \ o/          7 rue de la Ferme
  1030. X *      ||           78150 Le Chesnay   FRANCE
  1031. X *      ||      Contact The Software Winery at:
  1032. X *      ||           BBS     : +33 (1) 39 55 84 59  (V23 Videotex)
  1033. X *      ||           MAIL    : c/o Alain DIDIERJEAN 69 rue Dunois
  1034. X *      ||                     75646 Paris cedex 13 FRANCE
  1035. X *    <====>         INTERNET: rouaix@inria.inria.fr
  1036. X *===========================================================================
  1037. X */
  1038. X
  1039. X
  1040. X                    RXGEN README
  1041. X                    Version 1.0 (First released version)
  1042. X
  1043. XOverview:
  1044. X    RXGEN is an ARexx library designed for the hacker.
  1045. X    This library allows you to call any function of (almost) any amiga
  1046. X    library from a Arexx program.
  1047. X    I would say it is essentially useful under 2.0 to test some of
  1048. X    the new "high-level" features of the system. It also works under 1.3.
  1049. X    You can use the library to write small programs, when you don't want
  1050. X    to use your C-compiler ! Eventually, your program will get bigger and
  1051. X    bigger, and you'll find out that either you don't need your C-compiler,
  1052. X    or that Arexx is slow (heheh).
  1053. X
  1054. X
  1055. XDistribution:
  1056. X    The rxgen distribution consists in the following files
  1057. X        libs/rxgen.library      the library itself
  1058. X        rxgen.readme            (this file)
  1059. X        rxgen.doc               autodoc file
  1060. X        rexx/FD2rxFD.rexx       filter from FD.FILES to specific format
  1061. X
  1062. X        rexx/db.rexx            DisplayBeep example
  1063. X        rexx/wbfront.rexx       WBenchToFront example
  1064. X        rexx/alert.rexx         DisplayAlert example
  1065. X        rexx/port.rexx          MsgPort example
  1066. X
  1067. X        rexx/fd.rexx            Scanner for FD.FILES
  1068. X        rexx/wbmaster.rexx      AppMenuItems under 2.0
  1069. X
  1070. X    All the files of the distribution are Copyright (C) 1990 Francois Rouaix
  1071. X    and The Software Winery.
  1072. X    RXGEN is NOT Public Domain, but can be distributed freely, provided
  1073. X    all files are included, unmodified. Inclusion in a commercial product
  1074. X    requires previous written permission from the author.
  1075. X
  1076. XInstallation:
  1077. X    You will have to
  1078. X       -copy rxgen.library to your libs: directory (or any :libs directory
  1079. X        under 2.0)
  1080. X       -install the script FD2rxFD.rexx in your rexx: directory
  1081. X       -install rxgen.library in the list of arexx libraries with either
  1082. X        1> rxlib rxgen.library 0 -30 0
  1083. X        or the usual ARexx clause:
  1084. X        if ~show('L','rxgen.library') then call addlib('rxgen.library',0,-30,0)
  1085. X
  1086. XFunctionalities:
  1087. X    rxgen provides you with 3 functions,
  1088. X        GenOpenLib          generic open library
  1089. X        GenCloseLib         generic close library
  1090. X        GenACall            generic assembly call
  1091. X
  1092. X    GenACall will need a definition of the function it will call.
  1093. X    Fortunately, part of this definition can be obtained automatically
  1094. X    from the FD.FILES (found on the Extras disk), through the
  1095. X    ARexx program FD2rxFD. More details in the autodocs.
  1096. X
  1097. XIn the distribution, you will find an autodoc file for these three functions.
  1098. XYou're invited to check with the examples (the examples have to run, the doc
  1099. Xdoesn't). Examples are usually documented when needed (!).
  1100. X
  1101. XSpecial offer:
  1102. X   -INCLUDED in the distribution is an example (wbmaster.rexx) using a
  1103. X    new 2.0 feature of the Workbench: AppMenuItems
  1104. X    Read the comments. Use with care.
  1105. X
  1106. X   -INCLUDED in the distribution is an utility (fd.rexx) for scanning
  1107. X   the FD.FILES when looking for
  1108. X                    * either function OFFSET when function name is known
  1109. X                    * or function name when OFFSET is known
  1110. X
  1111. XBug reports, comments, suggestions: see my mail/e-mail address in the header
  1112. X
  1113. X                                    Francois Rouaix
  1114. X
  1115. END_OF_FILE
  1116. if test 4005 -ne `wc -c <'rxgen.readme'`; then
  1117.     echo shar: \"'rxgen.readme'\" unpacked with wrong size!
  1118. fi
  1119. chmod +x 'rxgen.readme'
  1120. # end of 'rxgen.readme'
  1121. fi
  1122. echo shar: End of archive 1 \(of 1\).
  1123. cp /dev/null ark1isdone
  1124. MISSING=""
  1125. for I in 1 ; do
  1126.     if test ! -f ark${I}isdone ; then
  1127.     MISSING="${MISSING} ${I}"
  1128.     fi
  1129. done
  1130. if test "${MISSING}" = "" ; then
  1131.     echo You have the archive.
  1132.     rm -f ark[1-9]isdone
  1133. else
  1134.     echo You still need to unpack the following archives:
  1135.     echo "        " ${MISSING}
  1136. fi
  1137. ##  End of shell archive.
  1138. exit 0
  1139. -- 
  1140. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  1141. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  1142. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  1143.